﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading.Tasks;
using System.Web;

namespace Oplaco.Samples.WebApi.Formatters
{
    /// <summary>
    /// 
    /// </summary>
    /// <see cref="http://antix.co.uk/Blog/Form-upload-through-the-WebAPI-Part-2-The-Server"/>
    /// <seealso cref="http://byterot.blogspot.nl/2012/04/aspnet-web-api-series-part-5.html"/>
    public class UploadMultipartMediaTypeFormatter : MediaTypeFormatter
    {
        private static Type _supportedType = typeof(BinaryFormatter);

        public UploadMultipartMediaTypeFormatter()
        {
            SupportedMediaTypes.Add(new MediaTypeHeaderValue("multipart/form-data"));
        }

        public override bool CanReadType(Type type)
        {
            return (type == _supportedType);
        }

        public override bool CanWriteType(Type type)
        {
            return (type == _supportedType);
        }

       
    }
}